﻿using Xenta.Entities;

namespace Xenta.Plugins
{
    /// <summary>
    /// Exposes the sales model interface.
    /// </summary>
    public interface ISalesModel : IPlugin
    {
        /// <summary>
        /// Determines, if the sales item is allowed to 
        /// be sold using the model.
        /// </summary>
        /// <param name="item">The sales item.</param>
        /// <returns>true if allowed; otherwise false.</returns>
        bool CanSale(SalesItemEntity item);

        /// <summary>
        /// Calculates handling fee.
        /// </summary>
        /// <param name="order">The order.</param>
        /// <returns>The handling fee amount.</returns>
        decimal CalcHandlingFee(OrderEntity order);

        /// <summary>
        /// The order handler.
        /// </summary>
        /// <param name="uow">The unit of work.</param>
        /// <param name="order">The order.</param>
        void OnOrderStatusChanged(IUnitOfWork uow, OrderEntity order);

        /// <summary>
        /// The payment handler.
        /// </summary>
        /// <param name="uow">The unit of work.</param>
        /// <param name="payment">The payment.</param>
        void OnPaymentStatusChanged(IUnitOfWork uow, PaymentEntity payment);

        /// <summary>
        /// The invoice handler.
        /// </summary>
        /// <param name="uow">The unit of work.</param>
        /// <param name="invoice">The invoice.</param>
        void OnInvoiceStatusChanged(IUnitOfWork uow, InvoiceEntity invoice);
    }
}
